bin=/home/phy/download/elasticsearch_jdbc/bin
lib=/home/phy/download/elasticsearch_jdbc/lib
echo '{
    "type" : "jdbc",
    "jdbc" : {
	"elasticsearch.autodiscover":true,
        "url" : "jdbc:mysql://10.10.31.129:3306/test",
        "user" : "root",
        "password" : "root",
	"statefile":"statefile.json",
	"schedule":"0 * * * * ?",
	"metrics":{"enabled": true},
        "sql" : [
		{
			"statement":"select *, id as _id from user where id > ?",
			"parameter":["$metrics.counter"]
		}
	],
	"elasticsearch":{
		"host":"10.10.31.149",
		"port":"9300"
	},
	"index":"test",
	"type":"user"
    }
}' | java \
       -cp "${lib}/*" \
       -Dlog4j.configurationFile=${bin}/log4j2.xml \
       org.xbib.tools.Runner \
       org.xbib.tools.JDBCImporter
